<!--  -->
<template>
  <div class="home">
    <div class="home-top"></div>
    <div class="home-bottom">
      <div class="menu">
        <el-menu
          active-text-color="#ffd04b"
          background-color="#545c64"
          class="el-menu-vertical-demo"
          default-active="2"
          text-color="#fff"
          router
        >
          <el-sub-menu
            :index="menu.id + ''"
            v-for="menu in menus"
            :key="menu.id"
          >
            <template #title>
              <span>{{ menu.title }}</span>
            </template>
            <template v-for="submenu in menu.children">
              <el-menu-item
                :index="`/${menu.name}/${submenu.name}`"
                v-if="!submenu.hidden"
                >{{ submenu.title }}</el-menu-item
              >
            </template>
          </el-sub-menu>
        </el-menu>
      </div>
      <!-- you -->
      <div class="right">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { computed } from "vue";
import { useAdminStore } from "../../store/modules/admin";

const adminStore = useAdminStore();
const menus = computed(() => adminStore.genNewMenus);
</script>
<style lang="less" scoped>
.home {
  height: 100vh;
  // background-color: #ccc;
  overflow: hidden;
  .home-top {
    height: 70px;
    background-color: #409eff;
  }
  .home-bottom {
    position: relative;
    .menu {
      position: absolute;
      height: 100%;
      // width: 250px;
      left: 0;
      .el-menu {
        height: calc(100vh - 70px);
        width: 250px;
        overflow: auto;
      }
    }
    .right {
      position: absolute;
      overflow: auto;
      right: 0;
      width: calc(100vw - 250px);
      height: calc(100vh - 70px);
    }
  }
}
</style>
